package com.erainm.springbootkafka.consumer;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * Created by erainm on 2021/9/9 10:39 上午.
 *
 * @Description TODO: 消费者
 **/
@Component
public class MyConsumer {
    @KafkaListener(topics = "topic-springboot-01")
    public void onMessage(ConsumerRecord<Integer,String> record){
        System.out.println("消费者收到的消息："
                                + record.topic() + "\t"
                                + record.partition() + "\t"
                                + record.offset() + "\t"
                                + record.key() + "\t"
                                + record.value());
    }
}
